package com.msunsoft.dataset.dictionary.validator;

/**
 * 表字段校验实体类
 * @author xuchengli
 *
 */
public class Validation implements Cloneable {

    private String tableName;//数据表名

    private String fieldName;//数据表字段名
    
    private String dictionaryCode;//字段所需字典编码
    
    private String dictionaryAlias;//字段所需字典含义
    
    private String isMust;//字段是否必填;

    public String getIsMust() {
		return isMust;
	}

	public void setIsMust(String isMust) {
		this.isMust = isMust;
	}

	public String getDictionaryCode() {
        return dictionaryCode;
    }

    public void setDictionaryCode(String dictionaryCode) {
        this.dictionaryCode = dictionaryCode;
    }

    public String getDictionaryAlias() {
        return dictionaryAlias;
    }

    public void setDictionaryAlias(String dictionaryAlias) {
        this.dictionaryAlias = dictionaryAlias;
    }

    public Validation() {
    }

    public Validation(String name) {
        this();
        this.fieldName = name;
    }

    @Override
    public Validation clone() {
        try {
            return (Validation) super.clone();
        } catch (CloneNotSupportedException e) {
            return null;
        }
    }

    public boolean equals(Validation validation) {
        return validation.getTableName().equalsIgnoreCase(tableName+fieldName);
    }

    /**
     * @return the field name to validate
     */
    public String getFieldName() {
        return fieldName;
    }

    /**
     * @param fieldName
     *            the field name to validate
     */
    public void setFieldName(String fieldName) {
        this.fieldName = fieldName;
    }

    /**
     * @return the name of this validation
     */
    public String getTableName() {
        return tableName;
    }

    /**
     * @param name
     *            the new name for this validation
     */
    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

}
